package com.aspose.cells;

class zbtd {
   private Color[] a = new Color[12];

   public zbtd() {
      this.a();
   }

   private void a() {
      for(int var1 = 0; var1 < this.a.length; ++var1) {
         this.a[var1] = this.a(var1);
      }

   }

   private Color a(int var1) {
      switch(var1) {
      case 0:
         return b("ffffff");
      case 1:
         return b("000000");
      case 2:
         return b("EEECE1");
      case 3:
         return b("1F497D");
      case 4:
         return b("4F81BD");
      case 5:
         return b("C0504D");
      case 6:
         return b("9BBB59");
      case 7:
         return b("8064A2");
      case 8:
         return b("4BACC6");
      case 9:
         return b("F79646");
      case 10:
         return b("0000FF");
      case 11:
         return b("800080");
      default:
         return b("000000");
      }
   }

   private static Color b(String var0) {
      int var1 = com.aspose.cells.b.a.zo.a(var0, 515, com.aspose.cells.b.a.c.za.b());
      Color var2 = Color.fromArgb(var1);
      var2 = Color.a(255, (Color)var2);
      return var2;
   }

   public void a(Color[] var1) {
      if (var1 != null && var1.length > 0) {
         int var2;
         for(var2 = 0; var2 < var1.length && var2 < this.a.length; ++var2) {
            if (!com.aspose.cells.a.c.zh.a(var1[var2])) {
               this.a[var2] = Color.fromArgb(255, var1[var2].getR() & 255, var1[var2].getG() & 255, var1[var2].getB() & 255);
            } else {
               this.a[var2] = this.a(var2);
            }
         }

         if (var2 < this.a.length) {
            while(var2 < this.a.length) {
               this.a[var2] = this.a(var2);
               ++var2;
            }
         }
      }

   }

   Color a(String var1) {
      int var2 = this.c(var1);
      return this.a[var2];
   }

   private int c(String var1) {
      boolean var2 = false;
      byte var3;
      if (!var1.equals("lt1") && !var1.equals("bg1")) {
         if (!var1.equals("dk1") && !var1.equals("tx1")) {
            if (!var1.equals("lt2") && !var1.equals("bg2")) {
               if (!var1.equals("dk2") && !var1.equals("tx2")) {
                  if (var1.equals("accent1")) {
                     var3 = 4;
                  } else if (var1.equals("accent2")) {
                     var3 = 5;
                  } else if (var1.equals("accent3")) {
                     var3 = 6;
                  } else if (var1.equals("accent4")) {
                     var3 = 7;
                  } else if (var1.equals("accent5")) {
                     var3 = 8;
                  } else if (var1.equals("accent6")) {
                     var3 = 9;
                  } else if (var1.equals("hlink")) {
                     var3 = 10;
                  } else if (var1.equals("folHlink")) {
                     var3 = 11;
                  } else {
                     var3 = 11;
                  }
               } else {
                  var3 = 3;
               }
            } else {
               var3 = 2;
            }
         } else {
            var3 = 1;
         }
      } else {
         var3 = 0;
      }

      return var3;
   }

   public Color[] a(int var1, int var2) {
      if (var2 <= 0) {
         return null;
      } else {
         Color[] var3 = new Color[6];

         int var4;
         for(var4 = 1; var4 < 7; ++var4) {
            var3[var4 - 1] = this.a("accent" + var4);
         }

         var4 = var1 % 8;
         Color[] var5;
         switch(var4) {
         case 0:
            var5 = this.a(new Color[]{var3[5]}, var4, var2);
            break;
         case 1:
            Color var6 = this.a("dk1");
            double[] var7;
            int var8;
            if (var1 == 41) {
               var7 = new double[]{0.05D, 0.55D, 0.78D, 0.15D, 0.7D, 0.3D};

               for(var8 = 0; var8 < 6; ++var8) {
                  var3[var8] = this.a(var6, var7[var8]);
               }

               return this.a(var3, var4, var2);
            }

            var7 = new double[]{0.88D, 0.55D, 0.78D, 0.92D, 0.7D, 0.3D};

            for(var8 = 0; var8 < 6; ++var8) {
               var3[var8] = this.a(var6, var7[var8]);
            }

            var5 = this.a(var3, var4, var2);
            break;
         case 2:
            var5 = this.a(var3, var4, var2);
            break;
         case 3:
            var5 = this.a(new Color[]{var3[0]}, var4, var2);
            break;
         case 4:
            var5 = this.a(new Color[]{var3[1]}, var4, var2);
            break;
         case 5:
            var5 = this.a(new Color[]{var3[2]}, var4, var2);
            break;
         case 6:
            var5 = this.a(new Color[]{var3[3]}, var4, var2);
            break;
         case 7:
            var5 = this.a(new Color[]{var3[4]}, var4, var2);
            break;
         default:
            var5 = this.a(var3, var4, var2);
         }

         this.b(var5);
         return var5;
      }
   }

   private Color[] a(Color[] var1, int var2, int var3) {
      Color[] var4 = new Color[var3];
      int var5 = 0;
      if ((var2 != 1 && var2 != 2 || var1.length != 6) && (var2 != 0 && var2 <= 2 || var1.length != 1)) {
         return null;
      } else {
         if (var1.length == 6) {
            if (var3 < var1.length) {
               while(var5 < var3) {
                  var4[var5] = var1[var5];
                  ++var5;
               }

               return var4;
            }
         } else if (var2 > 2 && var3 == 1) {
            var4[0] = var1[0];
            return var4;
         }

         boolean var6 = true;
         int var13;
         if (var1.length == 6) {
            var13 = var3 / 6 + 1;
         } else {
            var13 = var3;
         }

         int var7 = (int)((double)var13 / 2.0D + 0.5D);

         int var8;
         double var9;
         int var11;
         Color var12;
         Color var14;
         for(var8 = 1; var8 < var7 + 1 && var5 < var3; ++var8) {
            var9 = Math.floor(30.0D + 140.0D * (double)var8 / ((double)var13 + 1.0D)) / 100.0D;
            if (var1.length == 6) {
               for(var11 = 0; var11 < 6 && var5 < var3; ++var11) {
                  var12 = this.b(var1[var11], var9);
                  var4[var5] = var12;
                  ++var5;
               }
            } else {
               var14 = this.b(var1[0], var9);
               var4[var5] = var14;
               ++var5;
            }
         }

         for(; var8 < var13 + 1 && var5 < var3; ++var8) {
            var9 = Math.ceil(170.0D - 140.0D * (double)var8 / ((double)var13 + 1.0D)) / 100.0D;
            if (var1.length == 6) {
               for(var11 = 0; var11 < 6 && var5 < var3; ++var11) {
                  var12 = this.a(var1[var11], var9);
                  var4[var5] = var12;
                  ++var5;
               }
            } else {
               var14 = this.a(var1[0], var9);
               var4[var5] = var14;
               ++var5;
            }
         }

         return var4;
      }
   }

   Color a(Color var1, double var2) {
      int[] var4 = new int[]{var1.getR() & 255, var1.getG() & 255, var1.getB() & 255};

      for(int var5 = 0; var5 < 3; ++var5) {
         double var6 = this.b(var4[var5]);
         double var8 = var6 * (1.0D + (1.0D - var2));
         if (var2 > 0.0D) {
            var8 = var6 * (1.0D - (1.0D - var2)) + (1.0D - var2);
         }

         var4[var5] = this.a(var8);
      }

      return Color.fromArgb(var4[0], var4[1], var4[2]);
   }

   Color b(Color var1, double var2) {
      int[] var4 = new int[]{var1.getR() & 255, var1.getG() & 255, var1.getB() & 255};

      for(int var5 = 0; var5 < 3; ++var5) {
         double var6 = this.b(var4[var5]);
         double var8 = var6 * var2;
         if (var8 < 0.0D) {
            var8 = 0.0D;
         } else if (var8 > 1.0D) {
            var8 = 1.0D;
         }

         var4[var5] = this.a(var8);
      }

      return Color.fromArgb(var4[0], var4[1], var4[2]);
   }

   private double b(int var1) {
      double var2 = (double)var1 / 255.0D;
      double var4 = 0.0D;
      if (var2 < 0.0D) {
         var4 = 0.0D;
      } else if (var2 <= 0.04045D) {
         var4 = var2 / 12.92D;
      } else if (var2 <= 1.0D) {
         var4 = Math.pow((var2 + 0.055D) / 1.055D, 2.4D);
      } else {
         var4 = 1.0D;
      }

      return var4;
   }

   private int a(double var1) {
      double var3 = 0.0D;
      if (var1 < 0.0D) {
         var3 = 0.0D;
      } else if (var1 <= 0.0031308D) {
         var3 = var1 * 12.92D;
      } else if (var1 < 1.0D) {
         var3 = 1.055D * Math.pow(var1, 0.4166666666666667D) - 0.055D;
      } else {
         var3 = 1.0D;
      }

      return (int)com.aspose.cells.b.a.zq.a(var3 * 255.0D, 0, 1);
   }

   private void b(Color[] var1) {
      if (var1 != null) {
         for(int var2 = 0; var2 < var1.length; ++var2) {
            Color var3 = var1[var2];
            var1[var2] = Color.a(255, (Color)var3);
         }

      }
   }
}
